package com.itheima.health.job;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.health.service.OrderSettingService;
import com.itheima.health.utils.DateUtils;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * TODO
 *
 * @author Mr.Li
 */
@RestController
public class ClearOrderSettingJob {

    @Reference
    OrderSettingService orderSettingService;
    public void ClearOrderSetting(){

        try {
            //获得本月最后一天的日期         <!--每月最后一天凌晨2点-->
             //                              <!--0 0 2 L * ? -->
           // Date date =DateUtils.getLastDay4ThisMonth();
            //测试的日期
            String datetest="2020-01-18";
            Date date = DateUtils.parseString2Date(datetest,"yyyy-MM-dd");
            orderSettingService.ClearOrderSetting(date);
            System.out.println("清理预定信息成功");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("清理预定信息失败");
        }

    }
}
